package org.opens.magicByte;

import com.github.misterchangray.core.annotation.MagicClass;
import com.github.misterchangray.core.annotation.MagicField;
import lombok.Data;

@MagicClass()
@Data
public class Frames1 {

    /**
     * 同步头
     * 长度: 4Byte
     */
    @MagicField(order = 1)
    private int synchronizationHead;

    /**
     * 帧长
     * 长度: 2Byte
     */
    @MagicField(order = 2)
    private short frameLength;

    /**
     * 帧长hec
     * 长度: 2Byte
     */
    @MagicField(order = 3)
    private short frameLengthHec;

    /**
     * 目的站地址
     * 长度: 16Bit
     */
    @MagicField(order = 4)
    private short destinationAddress;

    /**
     * 源站地址
     * 长度: 16Bit
     */
    @MagicField(order = 5)
    private short originAddress;

    /**
     * 帧类型
     * 长度: 6Bit
     */
    @MagicField(order = 6)
    private short frameTypeAndPriorityAndHold;

    /**
     * 保密字段
     * 长度: 32Byte
     */
    @MagicField(order = 7, size = 4)
    private byte[] confidentialField;

    /**
     * 净荷
     * 长度: 112Byte
     */
    @MagicField(order = 8, size = 4)
    private byte[] netLoad;

    /**
     * 对象字段
     * - MagicByte对对象引用支持不好, 实际中不要定义对象字段
     */
    @MagicField(order = 9, size = 1)
    private Frames2[] frames2;

    /**
     * 帧crc
     * 长度: 2Byte
     */
    @MagicField(order = 10, size = 4)
    private byte[] frameCrc;

}
